package com.itheima.map;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Demo04 {

    public static void main(String[] args) {
        Map<String ,String> map= new TreeMap<>();
        map.put("马蓉","宋喆");
        map.put("小璐","PGone");
        map.put("杨幂","凯威");
        map.put("某某某","凯威");
        Set<Map.Entry<String, String>> entries = map.entrySet();

        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
        while (iterator.hasNext()){
            //System.out.println(iterator.next());
            Map.Entry<String, String> entry = iterator.next();
            System.out.println(entry);
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"@@@"+value);
        }


        for (Map.Entry<String, String> entry : entries) {
            //System.out.println(entry);
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"%%%"+value);
        }

        entries.forEach(entry-> System.out.println(entry.getKey()+"###"+entry.getValue()));
    }
}
